home *** CD-ROM | disk | FTP | other *** search
- /* SYSTEM HOST SCRIPT
-
- Written by Steven Kieffer
- 8/25/1990
- */
-
-
-
-
- STRING login_txt, pass_word, mail, username, userpassword
- STRING data_in, char, logtime
- INTEGER counter, keychar, bytes, mail_to, sysop
-
-
- -- FILES DIRECTORY SET-UP
-
- if null(arg(1)) then
- {
- alarm
- alert "No host file directory specified, (e.g. HOST C:\COMM).",OK
- end
- }
- menu_txt = arg(1) + "\menu.hst"
- Login_txt = arg(1) + "\login.hst"
- pass_word = arg(1) + "\password.hst"
- mail = arg(1) + "\mail.hst"
- help_txt = arg(1) + "\help.hst"
-
-
- clear
- linedelim = "^M^J"
- packetsize=1024
- --MODEM INITIALIZATION
-
- label init
- if online then bye : wait 2 seconds
- TRAP ON
- display off
- message "Initializing modem..."
- GO
- wait 2 seconds : reply modeminit
- wait 2 seconds : reply answersetup
-
- --WAIT FOR CALLER
- label wait
- CLS
- display on
- Print "WAITING FOR CALLER..."
- if not null(username) then
- {
- print : print
- print "The last caller was, " + username + ", who logged"
- print "in at " + logtime + "."
- }
- message "ESC=shutdown host ENTER=enter system"
- while not online
-
- keychar=inkey
- if keychar=27 then goto shutdown
- if keychar=13 then username = "Sysop" : goto start
- if error then goto init
- wend
-
-
- --LOG ON SEQUENCE
-
- label logon
- counter=0
-
- repeat
- username=""
- userpassword=""
- counter = counter + 1
- wait 1 second
- if online then reply:reply "^L":reply "^G"
- print "^L" : print "^G"
- if error then goto init
- wait 1 second
-
- if online then reply "What is your name or handle? ";
- print "What is your name or handle? ";
-
- repeat
- char = nextchar
- if error then goto init
- if not null(char) and char<>"^M" then
- {
- username = username + char
- if char = "^H" then username=left(username,length(username)-2)
- print char; : if online then reply char;
- if error then goto init
- }
- until char = "^M"
-
- if username is "" then goto bye_bye
-
- print : if online then reply
- if online then reply "What is your password? ";
- print "What is your password? ";
- nextline userpassword,30,30
-
- --Check password
-
- if error then goto init
- username = upcase(username)
- userpassword = upcase(userpassword)
- if exists(pass_word) then open input pass_word as 1
- else alert "Could not find PASSWORD.HST file !!!",ok : goto shutdown
- repeat
- read line #1,data_in
- data_in = upcase(data_in)
- if slice(data_in,1,";")=username and slice(data_in,2,";")=userpassword then
- {
- close #1
- goto start
- }
- until eof
- close #1
-
- until counter is 3
- goto bye_bye
-
-
- --Start of host system
-
- label start
-
- logname = username
- logtime = time
- if exists(login_txt) then gosub send_login
-
- label command
- repeat
-
- message username + " is online! ESC=hang-up user. X=delete mail"
-
- if exists(menu_txt) then
- {
- open input menu_txt as 1
- while not EOF
- read line #1, data_in
- if online then reply data_in
- print data_in
- wend
- close #1
- }
- else alert "Could not find MENU.HST file !!!",ok : goto shutdown
-
- --Check for input
- while inkey : wend
- repeat : until null(nextchar)
- keychar=0 : char=""
-
- while keychar=0 and char=""
- keychar=inkey
- if keychar then gosub check_cmd
- if error then goto init
-
- char=nextchar
- if error then goto init
- if not null(char) then gosub check_cmd
- if error then goto init
- wend
-
- until keychar=27
-
- goto bye_bye
-
- --check command
-
- label check_cmd
- if keychar <> 0 then char = chr(keychar) : Sysop is true
- char=upcase(char)
-
- if char = "C" then gosub chat_command
- if char = "D" then gosub download_command
- if char = "F" then gosub files_command
- if char = "G" then goto bye_bye
- if char = "H" then gosub help_command
- if char = "R" then gosub readmail_command
- if char = "P" then gosub postmail_command
- if char = "T" then gosub time_command
- if char = "U" then gosub upload_command
- if char = "X" then gosub clearmail_command
-
- return
-
-
-
- --SEND LOGIN MESSAGE
-
- label send_login
-
- if online then reply "^L"
- display on
- cls
- open input login_txt as #1
- while not EOF
- read line #1, data_in
- if online then reply data_in
- print data_in
- wend
- close #1
-
- return
-
- --BYE sequence
-
- label bye_bye
- if online then
- {
- reply "^G^G"
- reply "GOOD-BYE " + username + " !!!"
- }
- print "^G^G"
- print "GOOD-BYE " + username + " !!!"
-
- wait 1 second
- bye : wait 2 seconds
- goto init
-
- --Shutdown routine
-
- label shutdown
- cls
- print "Shutting down host..."
- display off
- wait 2 seconds
- if online then reply "+++";
- wait 2 seconds
- reply "ATS0=0"
- wait 1 second : reply
- display on
- bye : cls : print "Host is shutdown." : alarm : end
-
- -- ******COMMAND ROUTINES*******
-
-
- --download routine
-
- label download_command
- if not online then
- {
- print "You must be online. Remote function only."
- return
- }
-
- cls : if online then reply "^L"
- Print "== DOWNLOAD A FILE =="
- if online then reply "== DOWNLOAD A FILE =="
- print : if online then reply
- if online then reply "Select a protocol:"
- print "Select a protocol:"
- if online then reply
- if online then reply "X)modem/CRC Y)modem/batch Z)modem D)art"
- print "X)modem/CRC Y)modem/batch Z)modem D)art"
-
- watch 30 seconds for
- "x" : protocol "xmodem/crc" : goto download
- "y" : protocol "ymodem/batch" : goto download
- "z" : protocol "zmodem" : goto download
- "d" : protocol "dart" : goto download
- endwatch
-
- return
-
-
- label download
- data_in=""
- if online then reply : reply protocol : reply
- print : print protocol : print
- print "Name of file to download? ";
- if online then reply "Name of file to download? ";
- repeat
- char = nextchar
- if error then goto init
- if not null(char) and char<>"^M" then
- {
- data_in = data_in + char
- if char = "^H" then data_in = left(data_in,length(data_in)-2)
- print char; : if online then reply char;
- if error then goto init
- }
- until char = "^M"
- if online then reply : print
- data_in = dirfil + "\" + data_in
- if exists(data_in) then
- {
- if online then reply "^GStart your download..."
- print "^GStart your download..."
- send data_in
- }
- else return
-
- if online then reply : reply "^G^G^GDownload process completed !!!"
- print : print "^G^G^GDownload process completed !!!"
- if online then reply : print
- return
-
- --upload routine
-
- label upload_command
- if not online then
- {
- print "You must be online. Remote function only."
- return
- }
-
- cls : if online then reply "^L"
- print "== UPLOAD A FILE =="
- if online then reply"== UPLOAD A FILE =="
- print : if online then reply
- reply "Select a protocol:"
- print "Select a protocol:"
- reply : print
- reply "X)modem/CRC Y)modem/batch Z)modem D)art"
- print "X)modem/CRC Y)modem/batch Z)modem D)art"
-
- watch 30 seconds for
- "x" : protocol "xmodem/crc" : goto upload
- "y" : protocol "ymodem/batch" : goto upload
- "z" : protocol "zmodem" : goto upload
- "d" : protocol "dart" : recovery on : recvmode=1 : goto upload
- endwatch
-
- return
-
- label upload
-
- data_in=""
- if online then reply : reply protocol : reply
- print : print protocol : print
- print "Name of file to upload? ";
- if online then reply "Name of file to upload? ";
- repeat
- char = nextchar
- if error then goto init
- if not null(char) and char<>"^M" then
- {
- data_in = data_in + char
- if char = "^H" then data_in = left(data_in,length(data_in)-2)
- print char; : if online then reply char;
- if error then goto init
- }
- until char = "^M"
-
- if online then reply : reply "^GStart your upload..."
- print : print "^GStart your upload..."
- receive data_in
- if error then return
-
- if online then reply : reply "^G^G^GUpload process completed !!!"
- print : print "^G^G^GUpload process completed !!!"
- if online then reply : print
- return
-
- --Files directory routine
-
- label files_command
- cls : if online then reply "^L"
- if online then reply "Files available for downloading:" : reply
- print "Files available for downloading:" : print
-
- char = filefind(dirfil + "\*.*")
- bytes = filesize(dirfil + "\*.*")
- repeat
- print pad(char,16); : if online then reply pad(char,16);
- print bytes : if online then reply bytes
- char = filefind
- bytes = filesize
- until null(char)
- print : if online then reply
- wait 1 second
- keychar=1
- return
-
- --Help routine
-
- label help_command
- if not exists(help_txt) then return
- counter=0
- cls : if online then reply "^L"
- open input help_txt as #1
- repeat
- counter=counter +1
- read line #1, data_in
- if online then reply data_in
- print data_in
- if counter=20 then
- {
- print "---Press any key to continue---";
- if online then reply "---Press any key to continue---";
- repeat
- keychar=inkey
- char=nextchar
- until keychar or not null(char)
- print "^M"; : if online then reply "^M";
- print " ";
- if online then reply " ";
- print "^M"; : if online then reply "^M";
- }
- until EOF
- close #1
- wait 1 second
- print : if online then reply
- return
-
-
- --Chat routine
-
- label chat_command
-
-
- if sysop then
- {
- if online then reply "The Sysop would like to chat with you...^G^G"
- print "The Sysop would like to chat with you..."
- }
- else print "Paging the Sysop..." : if online then reply "Paging the Sysop..."
-
- sysop is false
- counter is 0
-
- repeat
- counter=counter + 1
- alarm : alarm
- wait 1 second
- until counter=3
-
- cls : if online then reply "^L"
- message username + " is online. Press // when done."
- if online then reply "== WHEN YOU ARE FINISHED CHATTING, PRESS // TO EXIT =="
- print "== WHEN YOU ARE FINISHED CHATTING, PRESS // TO EXIT =="
- if online then reply "____________________________________________________________"
- print "____________________________________________________________"
-
- counter=0
- repeat
- char=nextchar
- if error then goto init
- if not null(char) then
- {
- print char;
- if online then reply char;
- if error then goto init
- if char="/" then counter=counter+1 else counter=0
- }
- keychar=inkey
- if keychar then
- {
- print chr(keychar);
- if online then reply chr(keychar);
- if error then goto init
- if chr(keychar)="/" then counter=counter+1 else counter=0
- }
- if char = "^M" or chr(keychar) = "^M" then
- {
- print : if online then reply
- }
- until counter=2
- print : if online then reply
- return
-
- --Time routine
-
- label time_command
-
- print : if online then reply
- print "The current time is: "; : print time
- if online then reply "The current time is: "; : reply time
- print : if online then reply
-
- return
-
- --Read Mail routine
-
- label readmail_command
- cls : if online then reply "^L"
-
- if exists(mail) then
- {
- open input mail as #1
- repeat
- read line #1,data_in
- if data_in="***END***" then
- {
- data_in=""
- if online then reply "Press ENTER to continue. Press / to exit."
- print "Press ENTER to continue. Press / to exit."
- repeat
- char=nextchar
- keychar=inkey
- if intval(char)=47 or keychar=47 then
- {
- close #1 : print : if online then reply
- keychar=1 : return
- }
- until char="^M" or keychar=13
- cls : if online then reply "^L"
- }
- if online then reply data_in
- print data_in
- until EOF(1)
- close #1
- return
- }
-
- if online then reply "No mail today !!!"
- print "No mail today !!!"
- return
-
-
- --Post mail routine
-
- label postmail_command
-
- data_in=""
- while intval(char) : wend
- counter = 0
- mail_to is false
- cls : if online then reply "^L"
- open append mail as #1
- if online then reply "== WHEN FINISHED TYPING LETTER, PRESS // TO EXIT =="
- print "== WHEN FINISHED TYPING LETTER, PRESS // TO EXIT =="
- print : if online then reply
- if online then reply "Letter to: ";
- print "Letter to: ";
-
- repeat
- char=nextchar
- keychar=inkey
- if char = "^M" or keychar = 13 then gosub write_routine
- if not null(char) then
- {
- print char;
- if online then reply char;
- if char = "/" then counter=counter+1 else counter=0
- data_in = data_in + char
- if char = "^H" then data_in = left(data_in,length(data_in)-2)
- }
-
- if keychar then
- {
- print chr(keychar);
- if online then reply chr(keychar);
- if chr(keychar)="/" then counter=counter+1 else counter=0
- data_in = data_in + chr(keychar)
- if keychar=8 then data_in = left(data_in,length(data_in)-2)
- }
-
- until counter=2
-
- write line #1, ""
- write line #1, "______________________________________"
- write line #1, "***END***"
- close #1
-
- print : if online then reply
- return
-
- --write sub-routine
-
- label write_routine
-
- print : if online then reply
- if mail_to then write line #1, data_in ELSE
- {
- write line #1, "TO: " + data_in
- write line #1, "FROM: " + username
- write line #1, "______________________________________"
- write line #1, ""
- print "______________________________________"
- if online then reply "______________________________________"
- print : if online then reply
- }
- data_in=""
- char="" : keychar=0
- mail_to is true
- print ">";
- if online then reply ">";
- return
-
-
- --clear mail routine
-
- label clearmail_command
- if online then
- {
- alarm
- print "Privileged SYSOP command! Must be offline to use."
- return
- }
-
- alarm
- print "Are you sure you want to erase the mail ? [y/n] ";
- input char
- if upcase(char) = "Y" then
- {
- if exists(mail) then delete mail
- print "Mail is deleted !!!"
- return
- }
- return
-
-